package com.jeesite.modules.mo.service;

import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.mo.entity.MoUserDevice;
import com.jeesite.modules.mo.dao.MoUserDeviceDao;

/**
 * 用户设备Service
 * @author 李寒冰
 * @version 2024-10-22
 */
@Service
public class MoUserDeviceService extends CrudService<MoUserDeviceDao, MoUserDevice> {
	
	/**
	 * 获取单条数据
	 * @param moUserDevice
	 * @return
	 */
	@Override
	public MoUserDevice get(MoUserDevice moUserDevice) {
		return super.get(moUserDevice);
	}
	
	/**
	 * 查询分页数据
	 * @param moUserDevice 查询条件
	 * @param moUserDevice page 分页对象
	 * @return
	 */
	@Override
	public Page<MoUserDevice> findPage(MoUserDevice moUserDevice) {
		return super.findPage(moUserDevice);
	}
	
	/**
	 * 查询列表数据
	 * @param moUserDevice
	 * @return
	 */
	@Override
	public List<MoUserDevice> findList(MoUserDevice moUserDevice) {
		return super.findList(moUserDevice);
	}

	public MoUserDevice findBySn(String sn) {
		MoUserDevice moUserDevice = new MoUserDevice();
		moUserDevice.setSn(sn);
		List<MoUserDevice> list = findList(moUserDevice);
		if (list != null && list.size() > 0) {
			return list.get(0);
		}else{
			return null;
		}
	}

	/**
	 * 保存数据（插入或更新）
	 * @param moUserDevice
	 */
	@Override
	@Transactional
	public void save(MoUserDevice moUserDevice) {
		super.save(moUserDevice);
	}
	
	/**
	 * 更新状态
	 * @param moUserDevice
	 */
	@Override
	@Transactional
	public void updateStatus(MoUserDevice moUserDevice) {
		super.updateStatus(moUserDevice);
	}
	
	/**
	 * 删除数据
	 * @param moUserDevice
	 */
	@Override
	@Transactional
	public void delete(MoUserDevice moUserDevice) {
		super.delete(moUserDevice);
	}
	
}